surface: Rename gdk_surface_input_shape_combine_region
authorMatthias Clasen <mclasen@redhat.com>
Sun, 1 Mar 2020 19:29:06 +0000 (11:29 -0800)
committerMatthias Clasen <mclasen@redhat.com>
Wed, 11 Mar 2020 23:35:56 +0000 (19:35 -0400)
There is no shape combining going on anymore, so
call this just gdk_surface_set_input_region, and
remove the offset arguments too. All callers pass
0 anyway.

Update all callers and implementations.

gdk/broadway/gdksurface-broadway.c
gdk/gdksurface.c
gdk/gdksurface.h
gdk/gdksurfaceprivate.h
gdk/wayland/gdksurface-wayland.c
gdk/win32/gdksurface-win32.c
gdk/x11/gdksurface-x11.c
gtk/gtkpopover.c
gtk/gtkwindow.c

index 90efc414ef39e8a6c7295cdea084b2eeeab13bcc..644014262ce4ef61d00275ecdde7f5e51ac8f26c 100644 (file)
@@ -689,10 +689,8 @@ gdk_broadway_surface_get_device_state (GdkSurface      *surface,
 }
 
 static void
-gdk_broadway_surface_input_shape_combine_region (GdkSurface       *surface,
-                                                 const cairo_region_t *shape_region,
-                                                 gint             offset_x,
-                                                 gint             offset_y)
+gdk_broadway_surface_set_input_region (GdkSurface     *surface,
+                                       cairo_region_t *shape_region)
 {
 }
 
@@ -1410,7 +1408,7 @@ gdk_broadway_surface_class_init (GdkBroadwaySurfaceClass *klass)
   impl_class->get_geometry = gdk_broadway_surface_get_geometry;
   impl_class->get_root_coords = gdk_broadway_surface_get_root_coords;
   impl_class->get_device_state = gdk_broadway_surface_get_device_state;
-  impl_class->input_shape_combine_region = gdk_broadway_surface_input_shape_combine_region;
+  impl_class->set_input_region = gdk_broadway_surface_set_input_region;
   impl_class->destroy = _gdk_broadway_surface_destroy;
   impl_class->beep = gdk_broadway_surface_beep;
 
index 188c8dc230ba5fe17bfb74bc3af9d99ceda053b2..70a62487d241226aacf0b5fd52072d5e4124680e 100644 (file)
@@ -582,8 +582,8 @@ gdk_surface_finalize (GObject *object)
       _gdk_surface_destroy (surface, FALSE);
     }
 
-  if (surface->input_shape)
-    cairo_region_destroy (surface->input_shape);
+  if (surface->input_region)
+    cairo_region_destroy (surface->input_region);
 
   if (surface->cursor)
     g_object_unref (surface->cursor);
@@ -2372,11 +2372,9 @@ gdk_surface_get_root_coords (GdkSurface *surface,
 }
 
 /**
- * gdk_surface_input_shape_combine_region:
+ * gdk_surface_set_input_region:
  * @surface: a #GdkSurface
- * @shape_region: region of surface to be non-transparent
- * @offset_x: X position of @shape_region in @surface coordinates
- * @offset_y: Y position of @shape_region in @surface coordinates
+ * @region: region of surface to be reactive
  *
  * Apply the region to the surface for the purpose of event
  * handling. Mouse events which happen while the pointer position
@@ -2396,28 +2394,23 @@ gdk_surface_get_root_coords (GdkSurface *surface,
  * function does nothing.
  */
 void
-gdk_surface_input_shape_combine_region (GdkSurface       *surface,
-                                        const cairo_region_t *shape_region,
-                                        gint             offset_x,
-                                        gint             offset_y)
+gdk_surface_set_input_region (GdkSurface     *surface,
+                              cairo_region_t *region)
 {
   g_return_if_fail (GDK_IS_SURFACE (surface));
 
   if (GDK_SURFACE_DESTROYED (surface))
     return;
 
-  if (surface->input_shape)
-    cairo_region_destroy (surface->input_shape);
+  if (surface->input_region)
+    cairo_region_destroy (surface->input_region);
 
-  if (shape_region)
-    {
-      surface->input_shape = cairo_region_copy (shape_region);
-      cairo_region_translate (surface->input_shape, offset_x, offset_y);
-    }
+  if (region)
+    surface->input_region = cairo_region_copy (region);
   else
-    surface->input_shape = NULL;
+    surface->input_region = NULL;
 
-  GDK_SURFACE_GET_CLASS (surface)->input_shape_combine_region (surface, surface->input_shape, 0, 0);
+  GDK_SURFACE_GET_CLASS (surface)->set_input_region (surface, surface->input_region);
 }
 
 /**
index bc0753c5b925ed183563c6f3749a7b504143f873..bec64d2df77e728d8d31d9351552a0953183a8c9 100644 (file)
@@ -386,10 +386,8 @@ void          gdk_surface_set_focus_on_map      (GdkSurface     *surface,
                                                  gboolean       focus_on_map);
 
 GDK_AVAILABLE_IN_ALL
-void gdk_surface_input_shape_combine_region (GdkSurface       *surface,
-                                             const cairo_region_t *shape_region,
-                                             gint             offset_x,
-                                             gint             offset_y);
+void          gdk_surface_set_input_region      (GdkSurface     *surface,
+                                                 cairo_region_t *region);
 
 GDK_AVAILABLE_IN_ALL
 gboolean gdk_surface_is_viewable    (GdkSurface *surface);
index e1e1f3687cd9df7b6a363494902829b1213983eb..583a9bd12c5f204476e5412485d2196564c785d8 100644 (file)
@@ -89,7 +89,7 @@ struct _GdkSurface
   GdkCursor *cursor;
   GHashTable *device_cursor;
 
-  cairo_region_t *input_shape;
+  cairo_region_t *input_region;
 
   GList *devices_inside;
 
@@ -142,10 +142,8 @@ struct _GdkSurfaceClass
                                          gdouble         *y,
                                          GdkModifierType *mask);
 
-  void         (* input_shape_combine_region) (GdkSurface       *surface,
-                                               const cairo_region_t *shape_region,
-                                               gint             offset_x,
-                                               gint             offset_y);
+  void         (* set_input_region)     (GdkSurface      *surface,
+                                         cairo_region_t  *shape_region);
 
 /* Called to do the windowing system specific part of gdk_surface_destroy(),
  *
index e84bd3796069c563943117cbfa6a7b2d1c516e0b..de29755357b03eabce849f771949740ca7a14080 100644 (file)
@@ -2935,10 +2935,8 @@ gdk_wayland_surface_get_device_state (GdkSurface       *surface,
 }
 
 static void
-gdk_wayland_surface_input_shape_combine_region (GdkSurface           *surface,
-                                                const cairo_region_t *shape_region,
-                                                gint                  offset_x,
-                                                gint                  offset_y)
+gdk_wayland_surface_set_input_region (GdkSurface     *surface,
+                                      cairo_region_t *input_region)
 {
   GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
 
@@ -2947,11 +2945,8 @@ gdk_wayland_surface_input_shape_combine_region (GdkSurface           *surface,
 
   g_clear_pointer (&impl->input_region, cairo_region_destroy);
 
-  if (shape_region)
-    {
-      impl->input_region = cairo_region_copy (shape_region);
-      cairo_region_translate (impl->input_region, offset_x, offset_y);
-    }
+  if (input_region)
+    impl->input_region = cairo_region_copy (input_region);
 
   impl->input_region_dirty = TRUE;
 }
@@ -3909,7 +3904,7 @@ gdk_wayland_surface_class_init (GdkWaylandSurfaceClass *klass)
   impl_class->get_geometry = gdk_wayland_surface_get_geometry;
   impl_class->get_root_coords = gdk_wayland_surface_get_root_coords;
   impl_class->get_device_state = gdk_wayland_surface_get_device_state;
-  impl_class->input_shape_combine_region = gdk_wayland_surface_input_shape_combine_region;
+  impl_class->set_input_region = gdk_wayland_surface_set_input_region;
   impl_class->destroy = gdk_wayland_surface_destroy;
   impl_class->beep = gdk_wayland_surface_beep;
 
index 8e877ed3d7f2cb83e81f933bb474c51b6a4fc867..75d4b685939ef4325e777210afe05e46acf9e419 100644 (file)
@@ -5166,10 +5166,8 @@ _gdk_win32_surface_get_unscaled_size (GdkSurface *window,
 }
 
 static void
-gdk_win32_input_shape_combine_region (GdkSurface            *window,
-                                      const cairo_region_t *shape_region,
-                                      gint                  offset_x,
-                                      gint                  offset_y)
+gdk_win32_surface_set_input_region (GdkSurface     *window,
+                                    cairo_region_t *input_region)
 {
   /* Partial input shape support is implemented by handling the
    * NC_NCHITTEST message
@@ -5199,7 +5197,7 @@ gdk_win32_surface_class_init (GdkWin32SurfaceClass *klass)
   impl_class->get_device_state = gdk_surface_win32_get_device_state;
   impl_class->get_root_coords = gdk_win32_surface_get_root_coords;
 
-  impl_class->input_shape_combine_region = gdk_win32_input_shape_combine_region;
+  impl_class->set_input_region = gdk_win32_surface_set_input_region;
   impl_class->destroy = gdk_win32_surface_destroy;
 
   //impl_class->beep = gdk_x11_surface_beep;
index 411f0b5a6e08b3e27337a9d06723be8933def8cb..53a91af8a0853667fc248856157bf8ca067a41e9 100644 (file)
@@ -2617,10 +2617,8 @@ gdk_x11_surface_get_device_state (GdkSurface       *surface,
 }
 
 static void 
-gdk_x11_surface_input_shape_combine_region (GdkSurface           *surface,
-                                           const cairo_region_t *shape_region,
-                                           gint                  offset_x,
-                                           gint                  offset_y)
+gdk_x11_surface_set_input_region (GdkSurface     *surface,
+                                  cairo_region_t *input_region)
 {
 #ifdef ShapeInput
   GdkX11Surface *impl = GDK_X11_SURFACE (surface);
@@ -2631,7 +2629,7 @@ gdk_x11_surface_input_shape_combine_region (GdkSurface           *surface,
   if (!gdk_display_supports_input_shapes (GDK_SURFACE_DISPLAY (surface)))
     return;
 
-  if (shape_region == NULL)
+  if (input_region == NULL)
     {
       XShapeCombineMask (GDK_SURFACE_XDISPLAY (surface),
                          GDK_SURFACE_XID (surface),
@@ -2646,15 +2644,14 @@ gdk_x11_surface_input_shape_combine_region (GdkSurface           *surface,
       gint n_rects = 0;
       XRectangle *xrects = NULL;
 
-      _gdk_x11_region_get_xrectangles (shape_region,
+      _gdk_x11_region_get_xrectangles (input_region,
                                        0, 0, impl->surface_scale,
                                        &xrects, &n_rects);
       
       XShapeCombineRectangles (GDK_SURFACE_XDISPLAY (surface),
                                GDK_SURFACE_XID (surface),
                               ShapeInput,
-                               offset_x * impl->surface_scale,
-                               offset_y * impl->surface_scale,
+                               0, 0,
                                xrects, n_rects,
                                ShapeSet,
                                YXBanded);
@@ -4697,7 +4694,7 @@ gdk_x11_surface_class_init (GdkX11SurfaceClass *klass)
   impl_class->get_geometry = gdk_x11_surface_get_geometry;
   impl_class->get_root_coords = gdk_x11_surface_get_root_coords;
   impl_class->get_device_state = gdk_x11_surface_get_device_state;
-  impl_class->input_shape_combine_region = gdk_x11_surface_input_shape_combine_region;
+  impl_class->set_input_region = gdk_x11_surface_set_input_region;
   impl_class->destroy = gdk_x11_surface_destroy;
   impl_class->beep = gdk_x11_surface_beep;
 
index b3e3e79b3b1f876f117f38d60cd72a5df94c0c10..0224b21a42400ae459acc112bf7bdb5783ac5ff5 100644 (file)
@@ -1175,11 +1175,11 @@ gtk_popover_update_shape (GtkPopover *popover)
       region = gdk_cairo_region_create_from_surface (cairo_surface);
       cairo_surface_destroy (cairo_surface);
 
-      gdk_surface_input_shape_combine_region (priv->surface, region, 0, 0);
+      gdk_surface_set_input_region (priv->surface, region);
       cairo_region_destroy (region);
     }
   else
-    gdk_surface_input_shape_combine_region (priv->surface, NULL, 0, 0);
+    gdk_surface_set_input_region (priv->surface, NULL);
 }
 
 static gint
index ee054a20c3264d7441a2d075aa0f7092fd5b74ce..d34051c30c2724af8cb75be8890cd9bf0fd7d2ba 100644 (file)
@@ -5346,7 +5346,7 @@ update_csd_shape (GtkWindow *window)
       if (priv->extra_input_region)
         cairo_region_intersect (region, priv->extra_input_region);
 
-      gdk_surface_input_shape_combine_region (priv->surface, region, 0, 0);
+      gdk_surface_set_input_region (priv->surface, region);
       cairo_region_destroy (region);
     }
 }